Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto encrypted publish when recps is set #212

Merged
merged 5 commits into from
Mar 12, 2021
Merged

Conversation

arj03
Copy link
Member

@arj03 arj03 commented Mar 11, 2021

To fix #211. Current behaviour can be a bit of a gotcha when coming from db1. First commit is just a failing test.

@arj03
Copy link
Member Author

arj03 commented Mar 11, 2021

Tests are being annoying, seems like the compile of sodium takes too long time. Should be working now.

@github-actions
Copy link

Benchmark results

Part Duration
add 1000 elements 1539ms
Migrate (+db1) 9305ms
Migrate (alone) 4322ms
Migrate (+db1 +db2) 7657ms
Migrate (+db2) 3596ms
Migrate continuation (+db2) 1545ms
Memory usage without indexes 1075.77 MB = 37.93 MB + etc
Initial indexing 1153ms
Initial indexing maxCpu=86 6086ms
Initial indexing compat 1011ms
Two indexes updating concurrently 1060ms
key one initial 49ms
key two 2ms
key one again 2ms
reboot and key one again 52ms
latest root posts 695ms
latest posts 13ms
votes one initial 634ms
votes again 0ms
hasRoot 486ms
hasRoot again 1ms
author one posts 379ms
author two posts 62ms
dedicated author one posts 387ms
dedicated author one posts again 0ms
Maximum memory usage 1463.46 MB = 49.65 MB + etc
Indexes folder size 12.23mb

db.js Outdated
if (msg.recps) {
msg = ssbKeys.box(
msg,
msg.recps.map((x) => x.substr(1))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only supports classic encryption. A good start but we need an interface like add Boxer and addUnboxer right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I would rather do that in #90. Would like ssbc/ssb-fixtures#2 to be in a bit better shape before really looking at that again though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I was looking at that x.substr(1) and got confused. Do we need to remove the sigil @?

According to ssb-keys implementation, yes:

https://github.com/ssb-js/ssb-keys/blob/98569aa430e344b3ed144fcebf5d2755f7355bf6/index.js#L139

But according to how Patchwork does it right now, it checks if it's a Ref.isFeed():

https://github.com/ssbc/patchwork/blob/ae29bd7f91e16deac4bd88b099175fa85a419815/lib/depject/sbot.js#L172-L174

How does Patchwork even work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that it also works that way I'm open to maybe doing this without the substr. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this substr here seems not necessary if ssb-keys does it in utils.toBuffer

@github-actions
Copy link

Benchmark results

Part Duration
add 1000 elements 1657ms
Migrate (+db1) 6969ms
Migrate (alone) 3314ms
Migrate (+db1 +db2) 5814ms
Migrate (+db2) 3204ms
Migrate continuation (+db2) 1112ms
Memory usage without indexes 1079.19 MB = 36.95 MB + etc
Initial indexing 983ms
Initial indexing maxCpu=86 4960ms
Initial indexing compat 642ms
Two indexes updating concurrently 1038ms
key one initial 42ms
key two 3ms
key one again 8ms
reboot and key one again 36ms
latest root posts 544ms
latest posts 12ms
votes one initial 542ms
votes again 0ms
hasRoot 343ms
hasRoot again 0ms
author one posts 298ms
author two posts 56ms
dedicated author one posts 322ms
dedicated author one posts again 0ms
Maximum memory usage 1450.89 MB = 47.22 MB + etc
Indexes folder size 12.23mb

Copy link
Member

@staltz staltz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@arj03 arj03 merged commit 39d5d14 into master Mar 12, 2021
@arj03 arj03 deleted the auto-encrypt-private branch March 12, 2021 11:07
@github-actions
Copy link

Benchmark results

Part Duration
add 1000 elements 1552ms
Migrate (+db1) 8823ms
Migrate (alone) 4128ms
Migrate (+db1 +db2) 7572ms
Migrate (+db2) 3559ms
Migrate continuation (+db2) 1422ms
Memory usage without indexes 1085.71 MB = 36.20 MB + etc
Initial indexing 1201ms
Initial indexing maxCpu=86 5549ms
Initial indexing compat 999ms
Two indexes updating concurrently 1192ms
key one initial 55ms
key two 2ms
key one again 2ms
reboot and key one again 39ms
latest root posts 668ms
latest posts 24ms
votes one initial 676ms
votes again 1ms
hasRoot 460ms
hasRoot again 1ms
author one posts 361ms
author two posts 63ms
dedicated author one posts 382ms
dedicated author one posts again 0ms
Maximum memory usage 1438.20 MB = 46.42 MB + etc
Indexes folder size 12.23mb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Publish doesn't encrypt messages by default
3 participants